// MESSAGE ATT_BODY_DATA support class

#pragma once

namespace mavlink {
namespace fppa {
namespace msg {

/**
 * @brief ATT_BODY_DATA message
 *
 * ATT_BODY_DATA
 */
struct ATT_BODY_DATA : mavlink::Message {
    static constexpr msgid_t MSG_ID = 24;
    static constexpr size_t LENGTH = 148;
    static constexpr size_t MIN_LENGTH = 148;
    static constexpr uint8_t CRC_EXTRA = 156;
    static constexpr auto NAME = "ATT_BODY_DATA";


    uint32_t state0; /*<  calculating state. */
    uint32_t state1; /*<  calculating state. */
    uint32_t state2; /*<  calculating state. */
    float q0; /*<  quaternion q0. */
    float q1; /*<  quaternion q1. */
    float q2; /*<  quaternion q2. */
    float q3; /*<  quaternion q3. */
    float roll; /*<  roll angle. */
    float pitch; /*<  pitch angle. */
    float yaw; /*<  yaw angle. */
    float w_ib_b_x; /*<  x axis angle speed in B coordinate. */
    float w_ib_b_y; /*<  y axis angle speed in B coordinate. */
    float w_ib_b_z; /*<  z axis angle speed in B coordinate. */
    float w_ib_b_c_x; /*<  x axis angle speed control in B coordinate. */
    float w_ib_b_c_y; /*<  y axis angle speed control in B coordinate. */
    float w_ib_b_c_z; /*<  z axis angle speed control in B coordinate. */
    float w_ib_b_bia_x; /*<  Zero deviation of gyro x axis. */
    float w_ib_b_bia_y; /*<  Zero deviation of gyro y axis. */
    float w_ib_b_bia_z; /*<  Zero deviation of gyro z axis. */
    float f_ib_b_x; /*<  force in B coordinate. */
    float f_ib_b_y; /*<  force in B coordinate. */
    float f_ib_b_z; /*<  force in B coordinate. */
    float f_ib_b_bia_x; /*<  Zero deviation of force x axis. */
    float f_ib_b_bia_y; /*<  Zero deviation of force y axis. */
    float f_ib_b_bia_z; /*<  Zero deviation of force z axis. */
    float bm_x; /*<  x axis magnet in B coordinate. */
    float bm_y; /*<  y axis magnet in B coordinate. */
    float bm_z; /*<  z axis magnet in B coordinate. */
    float bm_bia_x; /*<  Zero deviation of magnet x axis. */
    float bm_bia_y; /*<  Zero deviation of magnet y axis. */
    float bm_bia_z; /*<  Zero deviation of magnet z axis. */
    float v_eb_n_x; /*<  x axis speed. */
    float v_eb_n_y; /*<  y axis speed. */
    float v_eb_n_z; /*<  z axis speed. */
    float p_eb_n_x; /*<  longitude. */
    float p_eb_n_y; /*<  latitude. */
    float p_eb_n_z; /*<  altitude. */


    inline std::string get_name(void) const override
    {
            return NAME;
    }

    inline Info get_message_info(void) const override
    {
            return { MSG_ID, LENGTH, MIN_LENGTH, CRC_EXTRA };
    }

    inline std::string to_yaml(void) const override
    {
        std::stringstream ss;

        ss << NAME << ":" << std::endl;
        ss << "  state0: " << state0 << std::endl;
        ss << "  state1: " << state1 << std::endl;
        ss << "  state2: " << state2 << std::endl;
        ss << "  q0: " << q0 << std::endl;
        ss << "  q1: " << q1 << std::endl;
        ss << "  q2: " << q2 << std::endl;
        ss << "  q3: " << q3 << std::endl;
        ss << "  roll: " << roll << std::endl;
        ss << "  pitch: " << pitch << std::endl;
        ss << "  yaw: " << yaw << std::endl;
        ss << "  w_ib_b_x: " << w_ib_b_x << std::endl;
        ss << "  w_ib_b_y: " << w_ib_b_y << std::endl;
        ss << "  w_ib_b_z: " << w_ib_b_z << std::endl;
        ss << "  w_ib_b_c_x: " << w_ib_b_c_x << std::endl;
        ss << "  w_ib_b_c_y: " << w_ib_b_c_y << std::endl;
        ss << "  w_ib_b_c_z: " << w_ib_b_c_z << std::endl;
        ss << "  w_ib_b_bia_x: " << w_ib_b_bia_x << std::endl;
        ss << "  w_ib_b_bia_y: " << w_ib_b_bia_y << std::endl;
        ss << "  w_ib_b_bia_z: " << w_ib_b_bia_z << std::endl;
        ss << "  f_ib_b_x: " << f_ib_b_x << std::endl;
        ss << "  f_ib_b_y: " << f_ib_b_y << std::endl;
        ss << "  f_ib_b_z: " << f_ib_b_z << std::endl;
        ss << "  f_ib_b_bia_x: " << f_ib_b_bia_x << std::endl;
        ss << "  f_ib_b_bia_y: " << f_ib_b_bia_y << std::endl;
        ss << "  f_ib_b_bia_z: " << f_ib_b_bia_z << std::endl;
        ss << "  bm_x: " << bm_x << std::endl;
        ss << "  bm_y: " << bm_y << std::endl;
        ss << "  bm_z: " << bm_z << std::endl;
        ss << "  bm_bia_x: " << bm_bia_x << std::endl;
        ss << "  bm_bia_y: " << bm_bia_y << std::endl;
        ss << "  bm_bia_z: " << bm_bia_z << std::endl;
        ss << "  v_eb_n_x: " << v_eb_n_x << std::endl;
        ss << "  v_eb_n_y: " << v_eb_n_y << std::endl;
        ss << "  v_eb_n_z: " << v_eb_n_z << std::endl;
        ss << "  p_eb_n_x: " << p_eb_n_x << std::endl;
        ss << "  p_eb_n_y: " << p_eb_n_y << std::endl;
        ss << "  p_eb_n_z: " << p_eb_n_z << std::endl;

        return ss.str();
    }

    inline void serialize(mavlink::MsgMap &map) const override
    {
        map.reset(MSG_ID, LENGTH);

        map << state0;                        // offset: 0
        map << state1;                        // offset: 4
        map << state2;                        // offset: 8
        map << q0;                            // offset: 12
        map << q1;                            // offset: 16
        map << q2;                            // offset: 20
        map << q3;                            // offset: 24
        map << roll;                          // offset: 28
        map << pitch;                         // offset: 32
        map << yaw;                           // offset: 36
        map << w_ib_b_x;                      // offset: 40
        map << w_ib_b_y;                      // offset: 44
        map << w_ib_b_z;                      // offset: 48
        map << w_ib_b_c_x;                    // offset: 52
        map << w_ib_b_c_y;                    // offset: 56
        map << w_ib_b_c_z;                    // offset: 60
        map << w_ib_b_bia_x;                  // offset: 64
        map << w_ib_b_bia_y;                  // offset: 68
        map << w_ib_b_bia_z;                  // offset: 72
        map << f_ib_b_x;                      // offset: 76
        map << f_ib_b_y;                      // offset: 80
        map << f_ib_b_z;                      // offset: 84
        map << f_ib_b_bia_x;                  // offset: 88
        map << f_ib_b_bia_y;                  // offset: 92
        map << f_ib_b_bia_z;                  // offset: 96
        map << bm_x;                          // offset: 100
        map << bm_y;                          // offset: 104
        map << bm_z;                          // offset: 108
        map << bm_bia_x;                      // offset: 112
        map << bm_bia_y;                      // offset: 116
        map << bm_bia_z;                      // offset: 120
        map << v_eb_n_x;                      // offset: 124
        map << v_eb_n_y;                      // offset: 128
        map << v_eb_n_z;                      // offset: 132
        map << p_eb_n_x;                      // offset: 136
        map << p_eb_n_y;                      // offset: 140
        map << p_eb_n_z;                      // offset: 144
    }

    inline void deserialize(mavlink::MsgMap &map) override
    {
        map >> state0;                        // offset: 0
        map >> state1;                        // offset: 4
        map >> state2;                        // offset: 8
        map >> q0;                            // offset: 12
        map >> q1;                            // offset: 16
        map >> q2;                            // offset: 20
        map >> q3;                            // offset: 24
        map >> roll;                          // offset: 28
        map >> pitch;                         // offset: 32
        map >> yaw;                           // offset: 36
        map >> w_ib_b_x;                      // offset: 40
        map >> w_ib_b_y;                      // offset: 44
        map >> w_ib_b_z;                      // offset: 48
        map >> w_ib_b_c_x;                    // offset: 52
        map >> w_ib_b_c_y;                    // offset: 56
        map >> w_ib_b_c_z;                    // offset: 60
        map >> w_ib_b_bia_x;                  // offset: 64
        map >> w_ib_b_bia_y;                  // offset: 68
        map >> w_ib_b_bia_z;                  // offset: 72
        map >> f_ib_b_x;                      // offset: 76
        map >> f_ib_b_y;                      // offset: 80
        map >> f_ib_b_z;                      // offset: 84
        map >> f_ib_b_bia_x;                  // offset: 88
        map >> f_ib_b_bia_y;                  // offset: 92
        map >> f_ib_b_bia_z;                  // offset: 96
        map >> bm_x;                          // offset: 100
        map >> bm_y;                          // offset: 104
        map >> bm_z;                          // offset: 108
        map >> bm_bia_x;                      // offset: 112
        map >> bm_bia_y;                      // offset: 116
        map >> bm_bia_z;                      // offset: 120
        map >> v_eb_n_x;                      // offset: 124
        map >> v_eb_n_y;                      // offset: 128
        map >> v_eb_n_z;                      // offset: 132
        map >> p_eb_n_x;                      // offset: 136
        map >> p_eb_n_y;                      // offset: 140
        map >> p_eb_n_z;                      // offset: 144
    }
};

} // namespace msg
} // namespace fppa
} // namespace mavlink
